package org.qqcui.designpattern.patterns.mediator;

/**
 * desc
 *
 * @author cuiqingqiang
 * @version 1.0
 * @date 2022/5/6 17:18
 **/
public class CoffeeMachine extends Colleague {
    public CoffeeMachine(Mediator mediator, String name) {
        super(mediator, name);
        mediator.registerColleague(name, this);
    }

    @Override
    public void sendMessage(int stateChange) {
        getMediator().getMessage(stateChange, getName());
    }

    public void startCoffee() {
        System.out.println("It's time to start coffee");
    }

    public void finishCoffee() {
        System.out.println("After 5 minutes");
        System.out.println("Coffee is OK");
        sendMessage(0);
    }
}
